// Find an element's absolute position, taken from:
// http://www.quirksmode.org/js/findpos.html
function findPos(obj) {
    var curleft = 0, curtop = 0;
    do {
        curleft += obj.offsetLeft;
        curtop += obj.offsetTop;
    } while (obj = obj.offsetParent);
    return [curleft, curtop];
}
function getFirstElementOfClass(cls) {
  var tags = document.getElementsByTagName('*');
  for (var i in tags)
    if (tags[i].className == cls)
      return tags[i];
  return null;
}
function filter(target, x, y){
    if (target) {
        var anchor = document.getElementById(target) || getFirstElementOfClass(target);
        if (anchor) {
            var pos = findPos(anchor);
            scrollBy(pos[0], pos[1]);
        }
    }
    if (x || y)
        scrollBy(x, y);
    log(["filter", target, x, y]);
}
filter(CNL.data.target, CNL.data.scrollX, CNL.data.scrollY);

